package com.gmail.bloim.serg.testrunner;

import java.io.*;

/**
 * User: Администратор
 * Date: 26.04.13
 * Time: 2:20
 */
public class FileWriterTestSubscriber implements TestExecutionSubscriber {
    private final File dir;

    public FileWriterTestSubscriber(File dir) {
        this.dir = dir;
    }

    @Override
    public OutputStream createOutputStream(Test test) throws IOException {
        return new FileOutputStream(new File(dir, test.getName()+".out"));
    }

    @Override
    public OutputStream createErrorStream(Test test) throws FileNotFoundException {
        return new FileOutputStream(new File(dir, test.getName()+".err"));
    }
}
